<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:rich="http://richfaces.org/rich">

<body>

<ui:composition template="template/template.xhtml">

	<ui:define name="left">
		<h:form>
			<h:panelGrid columns="1">
				<s:link view="/songList.xhtml" propagation="none">Song List</s:link>
            	<s:link view="/artistDetails.xhtml" propagation="none">
                    <f:verbatim>Artist:&amp;nbsp;</f:verbatim>
                    <h:outputText value="#{songHome.instance.artist.name}"/>
                    <f:param name="artistId" value="#{songHome.instance.artist.id}"/>
            	</s:link>
			</h:panelGrid>
		</h:form>
	</ui:define>

	<ui:define name="content">
		<s:div rendered="#{songHome.managed}">
			<h1>Edit song</h1>
		</s:div>
		<s:div rendered="#{not songHome.managed}">
			<h1>Add song</h1>
		</s:div>

		<p>Artist: <h:outputText value="#{songHome.instance.artist.name}" /></p>

		<p><h:message for="songForm:songTitle" /></p>

		<p><h:message for="songForm:songLyrics" /></p>

		<h:form id="songForm">
			<p>Title: <h:inputText id="songTitle"
				value="#{songHome.songTitle}" required="true" /></p>

			<p>Lyrics:</p>
			<h:inputTextarea id="songLyrics" value="#{songHome.songLyrics}"
				required="true" cols="50" rows="30" />
			<p><h:commandButton value="Add" action="#{songHome.save}"
				rendered="#{!songHome.managed}" /> <h:commandButton value="Update"
				action="#{songHome.save}" rendered="#{songHome.managed}" /> <h:commandButton
				value="Delete" action="#{songHome.remove}" immediate="true"
				rendered="#{songHome.managed}" /></p>
		</h:form>
	</ui:define>

</ui:composition>

</body>
</html>
